<template>
  <view>
    <view class="button-group">
      <view class="shop_item" v-for="(item,index) in buttonList" :key="index" @click="clickMenu(item.service)">
        <image class="image" :src="getImagePath(item.app_icon,true)" mode="">
        </image>
        <view class="item_name">{{item.menu_name}}</view>
      </view>
    </view>
  </view>
</template>

<script>
  const buttonList = [{
      menu_name: "血压数据",
      app_icon: '../../../static/img/xysj.png',
      service: "srvstore_health_user_blood_pressure_select"
    },
    {
      menu_name: "血糖数据",
      app_icon: '../../../static/img/xtsj.png',
      service: "srvstore_health_user_blood_sugar_select"
    },
    {
      menu_name: "风险评估",
      app_icon: '../../../static/img/fxpg.png',
      service: "srvstore_health_body_exam_select"
    },
    {
      menu_name: "体质量测",
      app_icon: '../../../static/img/tzlc.png',
      service: "srvstore_quality_measurement_select"
    }
  ]
  export default {
    data() {
      return {
        hy_no: "",
        buttonList: Object.freeze(buttonList),
        ignoreStoreNo:false, 
      }
    },
    methods: {
      clickMenu(e) {
        if (e) {
          let cond = [{
            colName: 'hy_no',
            ruleType: 'eq',
            value: this.hy_no
          }]
          let url =  `/pages/public/list/list?pageType=list&serviceName=${e}&cond=${JSON.stringify(cond)}`
          if(this.ignoreStoreNo){
            url+=`&ignoreStoreNo=true`
          }
          uni.navigateTo({
            url
          });
        }
      },
    },
    onLoad(option) {
      if(option.ignoreStoreNo){
        this.ignoreStoreNo = true
      }
      if (option.hy_no) {
        this.hy_no = option.hy_no
        uni.setNavigationBarTitle({
          title: '健康数据'
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
  .button-group {
    width: 100%;
    padding: 0px 16px;
    border-radius: 8px;
    margin-top: 12px;
    background: #FAFBFC;
    display: flex;
    flex-wrap: wrap;

    image {
      width: 40px;
      height: 40px;
      border-radius: 5px;
      background-color: #F1F1F1;
    }

    .shop_item {
      margin-top: 13px;
      width: 25%;
      text-align: center;

      .item_name {
        color: #9092A5;
        margin-top: 2px;
      }
    }
  }
</style>
